package com.lx.springmvcproject2.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lx.springmvcproject2.entity.Customer;
import com.lx.springmvcproject2.mapper.CustomerMapper;
import com.lx.springmvcproject2.service.CustomerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lx
 * @since 2021-11-03
 */
@Service
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {

    @Override
    public List<Customer> getCunstomerList(List<String> tels,String name) {
        QueryWrapper<Customer> queryWrapper=new QueryWrapper<>();
        if(tels!=null)
        {
            queryWrapper.in("tel",tels);
            return list(queryWrapper);
        }
        else if(!name.equals("-1"))
        {
            queryWrapper.like("username","%"+name+"%");
            return list(queryWrapper);
        }
        else
        {
            return list();
        }
    }
}
